<?php

class Form_News extends Zend_Form
{

    public function init()
    {
        $id = new Zend_Form_Element_Hidden("id");
        //$id->setLabel("Id: ");
        $id->setValue(0);
        $id->setRequired(true);
        $intValidator = new Zend_Validate_Int();
        $this->addElement($id, "id");
        
        
        $author = new Zend_Form_Element_Hidden("author");
        //$author->setLabel("Author: ");
        $author->setRequired(true);
        $intValidator = new Zend_Validate_Int();
        $this->addElement($author, "author");
        
        
        $title = new Zend_Form_Element_Text("title");
        $title->setLabel("Title: ");
        $title->setRequired(true);
        //$intValidator = new Zend_Validate_Int();
        $this->addElement($title, "title");
        
        
        $summary = new Zend_Form_Element_Textarea("summary");
        $summary->setLabel("Summary: ");
        //$summary->setAttrib("class","ckeditor");
        $this->addElement($summary, "summary");
        
        
        $content = new Zend_Form_Element_Textarea("content");
        $content->setLabel("Content: ");
        //$content->setAttrib("class","ckeditor");
        $content->setRequired(true);
        $this->addElement($content, "content");
        
        
        
        $created_on = new Zend_Form_Element_Hidden("created_on");
        $created_on->setValue(date("Y-m-d H:i:s"));
        $createdOnValidator = new Zend_Validate_Date();
        $createdOnValidator->setFormat("YYYY-MM-dd HH:mm:ss");
        $created_on->addValidator($createdOnValidator);
        $this->addElement($created_on, "created_on");
        
        
        $display_order = new Zend_Form_Element_Text("display_order");
        $display_order->setLabel("DisplayOrder: ");
        $display_order->setValue(1);
        $displayOrderValidator = new Zend_Validate_Int();
        $display_order->addValidator($displayOrderValidator);
        $this->addElement($display_order, "display_order");
        
        
        $display_positions = new Zend_Form_Element_Select("display_position");
        $display_positions->setLabel("Display Positions: ");
        $display_positions->addMultiOption(0, "默认（普通新闻列表页）");
        $display_positions->addMultiOption(1, "首页推荐");
        $displayPositionValidator = new Zend_Validate_Int();
        $display_positions->addValidator($displayPositionValidator);
        $this->addElement($display_positions, "display_position");
        
        
        $submit = new Zend_Form_Element_Submit("submit");
        $this->addElement($submit, "submit");
    }


}

